package kr.pe.johnkim.waiting.mobile.service;

import kr.pe.johnkim.waiting.mobile.dao.WaitingMemberRecommendationDao;
import kr.pe.johnkim.waiting.mobile.domain.WaitingMemberRecommendation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author : John_Kim <cale9797@gmail.com>
 * @date : 13. 7. 15.
 */
@Service
public class WaitingMemberRecommendationServiceImpl implements WaitingMemberRecommendationService {

    // SLF4J Logging
    private Logger logger = LoggerFactory.getLogger(WaitingMemberRecommendationServiceImpl.class);

    @Autowired
    private WaitingMemberRecommendationDao waitingMemberRecommendationDao;

    /**
     * 사용자의 추천 중복을 확인 한다.
     *
     * @param waitingMemberRecommendation
     * @return
     */
    @Override
    public WaitingMemberRecommendation selectDuplicationMemberRecommendation(WaitingMemberRecommendation waitingMemberRecommendation) {
        logger.info("selectDuplicationMemberRecommendation");
        return this.waitingMemberRecommendationDao.selectDuplicationMemberRecommendation(waitingMemberRecommendation);
    }

    /**
     * 사용자의 추천을 등록 한다.
     *
     * @param waitingMemberRecommendation
     */
    @Override
    public void registerMemberRecommendation(WaitingMemberRecommendation waitingMemberRecommendation) {
        logger.info("registerMemberRecommendation");
        this.waitingMemberRecommendationDao.registerMemberRecommendation(waitingMemberRecommendation);
    }

    /**
     * 사용자의 추천을 비활성화 한다.
     *
     * @param waitingMemberRecommendation
     */
    @Override
    public void updateDeactivateMemberRecommendation(WaitingMemberRecommendation waitingMemberRecommendation) {
        logger.info("updateDeactivateMemberRecommendation");
        this.waitingMemberRecommendationDao.updateDeactivateMemberRecommendation(waitingMemberRecommendation);
    }

    /**
     * 특정 사용자의 추천 목록을 가져 온다.
     *
     * @param waitingMemberRecommendation
     * @return
     */
    @Override
    public List<WaitingMemberRecommendation> selectMemberRecommendationList(WaitingMemberRecommendation waitingMemberRecommendation) {
        logger.info("selectMemberRecommendationList");
        return this.waitingMemberRecommendationDao.selectMemberRecommendationList(waitingMemberRecommendation);
    }

    /**
     * 특정 가맹점에 대한 사용자 추천 목록을 가져 온다.
     *
     * @param waitingMemberRecommendation
     * @return
     */
    @Override
    public List<WaitingMemberRecommendation> selectMerchantRecommendationList(WaitingMemberRecommendation waitingMemberRecommendation) {
        logger.info("selectMerchantRecommendationList");
        return this.waitingMemberRecommendationDao.selectMerchantRecommendationList(waitingMemberRecommendation);
    }
}
